<template>
  <div style="height: 100%;background-color: transparent;">
    <x-header :left-options="{backText:'返回'}">项目视频</x-header>
    <simple-search @onSearch.prevent="search" :placeholder="'请输入图片主题来发起搜索'"></simple-search>
    <div class='container'>
      <!-- <scroller :on-refresh="refresh" :on-infinite="infinite"> -->
        <div class='card' v-for='(obj,index) in cardlist' :key="index" @click='open(obj.attachment)'>
          <ul>
            <li>{{obj.sub}}</li>
            <li>{{obj.inputer}}</li>
            <li>{{obj.inputdate}}</li>
          </ul>
        </div>
      <!-- </scroller> -->
    </div>
  </div>
</template>
<script>
export default {
  name:'projectVideo',
  data(){
    return {
      page:1,
      list:[],
      cardlist:[],
      datatype:'',
      datapath:'',
      filepath:[],
      loading:false
    }
  },
  mounted(){
    this.getData();
  },
  methods:{
    search(){
      alert(1)
    },
    refresh(){
      this.getData()
    },
    infinite(){
      this.getData()
    },
    getData() {
      var params='{"_method":"DESIGN_MEDIAUPLOAD.getMedia","sysprjId":"2147"}';
      this.$ajax({
        method:'post',
        url: '/cloudpm/servlet/Action.cmd',
        data:{
          FixJSON: params
        }
      }).then((res) => {
        this.datatype=res.data.data1;
        this.datapath=res.data.data2;
        var datatype=this.datatype;
        var datapath=this.datapath;
        for(var i in datatype){
          if(datatype[i].TYPE=='视频'){
              var obj={};
              obj.sub=datatype[i].SUBJECT;
              obj.inputer=datatype[i].INPUTER;
              obj.inputdate=datatype[i].INPUTDATE;
              obj.attachment=datatype[i].ATTACHMENT;
              this.cardlist.push(obj);
          }
        }
      })
    },
    open(att){
      var path=this.datapath;
      this.filepath=[];
      for(var i in path){
        if(att == path[i].FIELD_TOKEN){
          this.filepath.push(path[i].FILE_NAME);
        }
      }
      var params=JSON.stringify(this.filepath);
      this.$router.push({path:'/projectDisplay/projectVideo/projectVideo_detail',query:{params:params}})
    }
  }
}
</script>
<style scoped>
  ul,li{
    padding:0;margin:0;
  }
  .card{
    border:1px solid #ccc;
    margin:5%;
    padding:5%;
    border-radius:10px;
  }
  .card>ul{
    display:flex;
    justify-content: space-between;
  }
</style>
